import Vue from 'vue'
import Router from 'vue-router'

const AuthLayout = () => import(/* webpackChunkName: "auth" */ '@/views/auth.vue')
const SignIn = () => import(/* webpackChunkName: "auth" */ '@/views/auth/sign_in.vue')

const MainLayout = () => import(/* webpackChunkName: "main" */ '@/views/main.vue')
const Recommends = () => import(/* webpackChunkName: "main-recommends" */ '@/views/recommends')
const MaterialLibraries = () => import(/* webpackChunkName: "main-material-libraries" */ '@/views/material_libraries')

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    // 主路由
    {
      path: '/',
      component: MainLayout,
      children: [
        {
         path: '',
         name: 'recommends_path',
         component: Recommends
       },
       {
         path: 'material_libraries',
         name: 'material_libraries_path',
         component: MaterialLibraries
       }
      ]
    },
    // 登录路由
    {
      path: '/sign_in',
      component: AuthLayout,
      children: [
        {
          path: '',
          name: 'sign_in_path',
          component: SignIn
        }
      ]
    }
  ]
})
